import sys

MONTH = {'January' : 1, 'February' : 2, 'March' : 3, 'April' : 4, 'May' : 5, 'June' : 6,
        'July' : 7, 'August' : 8, 'September' : 9, 'October' : 10, 'November' : 11, 'December' : 12}
dayOfMonth = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

#判断闰年
def isLeap(year):
    if (not(year % 100) and not(year % 400)) or ((year % 100) and not(year % 4)):
        return True
    else:
        return False

#读取数据顺便判断格式是否正确，判断输入的是不是数字月份，还有日期是不是在范围内
def judgeInput(date):
    if len(date) != 2:
        return False

    if not(date[1].isdigit()):
        return False
    else:
        date[1] = int(date[1])
        if (isLeap(date[1])):
            dayOfMonth[2] = 29
        else:
            dayOfMonth[2] = 28

    date[0] = date[0].split()
    if len(date[0]) != 2:
        return False

    if date[0][0].isdigit() and date[0][1] in MONTH:
        date[0][0] = int(date[0][0])
        date[0][1] = MONTH[date[0][1]]
        #看日有没有超过当月最多天数
        if date[0][0] > dayOfMonth[date[0][1]] or date[0][0] == 0:
            return False
        else:
            return True
    else:
        return False

if __name__ == '__main__':

    date1 = input('请输入日期 格式为:30 August, 2012\n').split(', ')
    date2 = input().split(', ')

    while not(judgeInput(date1)) or not(judgeInput(date2)):
        print('输入格式错误')
        date1 = input('请输入日期 格式为:30 August, 2012\n').split(', ')
        date2 = input().split(', ')

    date1 = [date1[1], date1[0][1], date1[0][0]]
    date2 = [date2[1], date2[0][1], date2[0][0]]
    #判断一下日期先后
    if date1 > date2:
        date1, date2 = date2, date1
    elif date1 == date2:
        print(0)
        sys.exit()

    #没有用datetime，就需要判断会不会同年 同月 是否闰年
    if date1[0] < date2[0]:
        days = dayOfMonth[date1[1]] - date1[2]
        for i in range(date1[1] + 1, 13):
            days += dayOfMonth[i]

        year = date1[0] + 1
        while year < date2[0]:
            if isLeap(year):
                days += 366
            else:
                days += 365
            year += 1

        if (isLeap(date2[0])):
            dayOfMonth[2] = 29
        else:
            dayOfMonth[2] = 28

        for i in range(1, date2[1]):
            days += dayOfMonth[i]

        days += date2[2]

    #同年同月
    elif date1[1] == date2[1]:
        days = date2[2] - date1[2]
    #同年不同月
    else:
        days = dayOfMonth[date1[1]] - date1[2]
        for i in range(date1[1] + 1, date2[1]):
            days += dayOfMonth[i]
        days += date2[2]

    print(days)
    input("Press any key to continue")
